export default [
  "number",
  "$cardinal",
  function ($number, $cardinal) {
    return {
      attrs: {
        cx: $number(100)(true),
        cy: $number(100)(true),
      },
      link(painter, attr) {
        painter.config({
          fillStyle: "red",
          strokeStyle: "blue",
        });
        // painter.fillCircle(attr.cx, attr.cy, 3);

        var cardinal = $cardinal({
          // 可选，设置张弛系数，默认0，分水岭-1，值越大，曲线走势调整的越严重
          t: 1,
        });
        cardinal.setP([
          [100, 100],
          [300, 300],
        ]);
        painter.beginPath();
        for (let i = 100; i < 300; i++) {
          painter.lineTo(i, cardinal(i));
        }
        painter.stroke();
      },
    };
  },
];
